package com.niit.apis;

import com.niit.entity.Message;
import com.niit.entity.MessageObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 张月
 * @apiNote
 */
@FeignClient(name = "message-service")
public interface MessageFeignApi {
    //查找联系人
    @PostMapping("/api/messages/contacts")
    List<Message> getContacts(@RequestParam Integer id);
    //查找聊天记录
    @GetMapping("/api/messages/get")
    List<Message> getChatMessages(@RequestParam Integer senderId, @RequestParam Integer receiverId);
    //创建消息对象
    @GetMapping("/api/messages/findOrCreateMessageObject")
    MessageObject findOrCreateMessageObject(@RequestParam Integer senderId, @RequestParam Integer receiverId);
    //发送消息
    @PostMapping("/api/messages/send")
    Message sendMessage(@RequestBody Message message);
    //撤回消息
    @PostMapping("/api/messages/recall/{messageId}")
    void recallMessage(@PathVariable Integer messageId);
    //标记已读
    @PostMapping("/api/messages/read/{messageId}")
    void markAsRead(@PathVariable Integer messageId);
    //检查是否被拉黑
    @GetMapping("/api/messages/checkBlockStatus")
    Boolean checkBlockStatus(@RequestParam Integer senderId, @RequestParam Integer receiverId);
}
